# -*- coding: utf-8 -*-

""" 
    Bookshelf - twExtJS sample use with Pylons
    
    Distributed under the terms of Lesser GNU Public License
    (c) 2007 - Ricardo Girardi Sixel 
"""

from formencode import validators
from toscawidgets.widgets.extJS.form import FormPanel, HiddenField,TextField
    
from toscawidgets.api import WidgetsList
from toscawidgets.widgets.extJS.data import JSONReader,Record,Store

class BookForm(FormPanel):
    name = 'BookForm'
    url='/book/save'
    renderTo = 'contentpanel'
    ds = Store()
        
    class fields(WidgetsList):
        id = HiddenField(name='id',default=0)
        title = TextField(name='title',fieldLabel = u'Title', validator = validators.UnicodeString(not_empty=True))
        authors = TextField(name='authors',fieldLabel = 'Authors', validator = validators.UnicodeString(not_empty=True))
        publisher = TextField(name='publisher', validator = validators.UnicodeString(not_empty=True))
        isbn = TextField(name='isbn', fieldLabel=u'ISBN')
        edition = TextField(name='edition', fieldLabel=u'Edition')
